import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/login', component: () => import('@/views/login/loginPage.vue') },
    {
      path: '/',
      component: () => import('@/views/layout/LayoutContainer.vue'),
      redirect: '/borrow',
      children: [
        {
          path: '/borrow',
          name: 'BorrowManagement',
          component: () => import('@/views/BorrowManagement.vue'),
          meta: { title: '借阅管理' }
        },
        {
          path: '/books',
          name: 'BookManagement',
          component: () => import('@/views/BookManagement.vue'),
          meta: { title: '图书管理' }
        },
        {
          path: '/readers',
          name: 'ReaderManagement',
          component: () => import('@/views/ReaderManagement.vue'),
          meta: { title: '读者管理' }
        },
        {
          path: '/categories',
          name: 'CategoryManagement',
          component: () => import('@/views/CategoryManagement.vue'),
          meta: { title: '分类管理' }
        },
        {
          path: '/notices',
          name: 'NoticeManagement',
          component: () => import('@/views/NoticeManagement.vue'),
          meta: { title: '公告管理' }
        },
        {
          path: '/admins',
          name: 'AdminManagement',
          component: () => import('@/views/AdminManagement.vue'),
          meta: { title: '管理员管理' }
        },
        {
          path: '/statistics',
          name: 'StatisticalAnalysis',
          component: () => import('@/views/StatisticalAnalysis.vue'),
          meta: { title: '统计分析' }
        }
      ]
    }
  ]
})

export default router
